@extends('layouts.admin_iframe')
@section('content')
		<table class="table table-hover">
			<tr class="active">
			  <th width="150">tid</th>
			  <th>类型名称</th>

			  <th width="300">操作</th>
			</tr>
			@foreach($type_datas as $tds)
			<tr>
				<td>{{$tds->tid}}</td>
				<td>{{$tds->tname}}</td>

				<td>
					<a href="{{url('admin/attr/'.$tds->tid)}}" class="btn btn-sm btn-primary">编辑属性</a>
					<a href="{{url('admin/type/'.$tds->tid.'/edit')}}" class="btn btn-sm btn-warning">编辑类型</a>
					<a href="javascript:;" onclick="cate_del({{$tds->tid}})" class="btn btn-sm btn-danger">删除</a>
				</td>
			</tr>
				@endforeach
		</table>
		<script>
			function cate_del(tid){
				layer.confirm('您确定要删除此分类吗？', {
					btn: ['确定','取消'] //按钮
				}, function(){

					$.post("{{url('admin/type/')}}/" + tid, {'_token': '{{csrf_token()}}','_method': 'delete'}, function(db){
						if (db.status == 1) {
							window.location.reload();
							layer.msg(db.msg, {icon: 6});
						} else {
							layer.msg(db.msg, {icon: 5});
						}
					});
				}, function(){

				});
			}


		</script>
		{{--<script>--}}
			{{--function order_change(obj,cate_id){--}}
				{{--var cate_order = $(obj).val();--}}
				{{--$.post("{{url('admin/cate/order_change')}}",{'_token':'{{csrf_token()}}','cid':cate_id,'sort':cate_order},function(data){--}}
	{{--//				alert(data.msg);--}}
					{{--if(data.status==1){--}}
						{{--layer.msg(data.msg, {icon: 6});--}}
					{{--}else{--}}
						{{--layer.msg(data.msg, {icon: 5});--}}
					{{--}--}}
				{{--});--}}
			{{--}--}}
		{{--</script>--}}

@endsection
